package com.itlong.cloud.property.resource;

import com.itlong.cloud.POJO.PO.ProjectPO;
import com.itlong.cloud.project.property.IPropertyPayPasswordServiceClient;
import com.itlong.cloud.property.service.IPropertyPayPasswordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <desc>
 *      物业支付密码暴露接口实现类
 * </desc>
 *
 * @createDate 2018/09/25
 */
@RestController
public class PropertyPayPasswordServiceResource implements IPropertyPayPasswordServiceClient{

    @Autowired
    IPropertyPayPasswordService iPropertyPayPasswordService;

    /**
     * <desc>
     *      修改支付密码
     * </desc>
     *
     * @param projectId 项目id
     * @param password 旧支付密码
     * @return
     * @author Jiaqi.X
     * @createDate 2018/09/25
     */
    @Override
    @PostMapping(path = "/property/system/payPassword/updatePayPassword")
    public Integer updatePayPassword(@RequestParam("projectId") String projectId, @RequestParam("password") String password) {
        return iPropertyPayPasswordService.updatePayPassword(projectId,password);
    }

    /**
     * <desc>
     *      获取项目支付密码详情
     * </desc>
     *
     * @param projectId
     * @return
     * @author Jiaqi.X
     * @createDate 2018/09/25
     */
    @Override
    @PostMapping(path = "/property/system/payPassword/getProjectInfo")
    public ProjectPO getProjectInfo(@RequestParam("projectId") String projectId) {
        return iPropertyPayPasswordService.getProjectInfo(projectId);
    }

    /**
     * <desc>
     *      验证银行卡信息
     * </desc>
     *
     * @param userName
     * @param bankCardNo
     * @return
     * @author Jiaqi.X
     * @createDate 2018/09/25
     */
    @Override
    @PostMapping(path = "/property/system/payPassword/checkBankInfo")
    public Integer checkBankInfo(@RequestParam("projectId") String projectId, @RequestParam("userName") String userName, @RequestParam("bankCardNo") String bankCardNo) {
        return iPropertyPayPasswordService.checkBankInfo(projectId,userName,bankCardNo);
    }
}
